import 'package:chathouse/public/Config.dart';
import 'package:flutter/material.dart';

import '../../../util/base_utils.dart';
import '../../base/base.dart';

/// @class : all_order_dertail
/// @date : 2023-03-23 10:59
/// @name : LFC
/// @description : 客戶評語
class CommentDetailPage extends BaseStatefulWidget {
  Map? para;

  CommentDetailPage(this.para, {Key? key}) : super(key: key);

  @override
  _CommentDetailPageState createState() => _CommentDetailPageState(para);
}

class _CommentDetailPageState
    extends BaseStatefulWidgetState<CommentDetailPage> {
  Map? para;

  _CommentDetailPageState(this.para);

  @override
  void initState() {
    super.initState();
    updateEmptyPage(tipTitle: "暫無服務數據");
    updateState(LoadState.success);
    setState(() {
      appBarTitle = para?["type"] == 1 ? "我的評語" : "客戶評語";
      showAppBar = true;
      scaffoldBackColor = Colors.white;
    });
  }

  @override
  Widget viewPageBody() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 35.w, vertical: 30.w),
      color: Colors.white,
      child: ListView(
        children: [
          Row(
            children: [
              Text("服務：",
                  style: getTextStyle(20.sp,
                      color: Colors.black, fontType: FontType.BOLD)),
              Text(para?["serviceName"] ?? "",
                  style: getTextStyle(20.sp,
                      color: MyColors.gary_117117117, fontType: FontType.BOLD)),
            ],
          ),
          SizedBox(
            height: 10.w,
          ),
          Row(
            children: [
              Text(para?["type"] == 1 ?  "專家：":"客戶：",
                  style: getTextStyle(20.sp,
                      color: Colors.black, fontType: FontType.BOLD)),
              Text(para?["membersName"] ?? "",
                  style: getTextStyle(20.sp,
                      color: MyColors.gary_117117117, fontType: FontType.BOLD)),
            ],
          ),
          SizedBox(
            height: 10.w,
          ),
          Row(
            children: [
              Text("評分：",
                  style: getTextStyle(20.sp,
                      color: Colors.black, fontType: FontType.BOLD)),
              Container(
                width: 100,
                height: 20,
                margin: EdgeInsets.only(top: 4.w),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  children:
                      List.generate(para?["serviceEvaluation"] ?? 0, (index) {
                    return const Icon(Icons.star,
                        size: 18, color: Colors.redAccent);
                  }),
                ),
              ),
            ],
          ),
          SizedBox(
            height: 10.w,
          ),
          Row(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text("評語：",
                  style: getTextStyle(20.sp,
                      color: Colors.black, fontType: FontType.BOLD)),
              Expanded(
                child: Text(para?["comUser"] ?? "",
                    style: getTextStyle(20.sp,
                        color: MyColors.gary_117117117,
                        fontType: FontType.BOLD)),
              ),
            ],
          )
        ],
      ),
    );
  }
}
